<admintpl file="header" />
</head>
<script>
	var idTmr;
	function  getExplorer() {
		var explorer = window.navigator.userAgent ;
		//ie
		if (explorer.indexOf("MSIE") >= 0) {
			return 'ie';
		}
		//firefox
		else if (explorer.indexOf("Firefox") >= 0) {
			return 'Firefox';
		}
		//Chrome
		else if(explorer.indexOf("Chrome") >= 0){
			return 'Chrome';
		}
		//Opera
		else if(explorer.indexOf("Opera") >= 0){
			return 'Opera';
		}
		//Safari
		else if(explorer.indexOf("Safari") >= 0){
			return 'Safari';
		}
	}
	function method5(tableid) {
		if(getExplorer()=='ie')
		{
			var curTbl = document.getElementById(tableid);
			var oXL = new ActiveXObject("Excel.Application");
			var oWB = oXL.Workbooks.Add();
			var xlsheet = oWB.Worksheets(1);
			var sel = document.body.createTextRange();
			sel.moveToElementText(curTbl);
			sel.select();
			sel.execCommand("Copy");
			xlsheet.Paste();
			oXL.Visible = true;

			try {
				var fname = oXL.Application.GetSaveAsFilename("Excel.xls", "Excel Spreadsheets (*.xls), *.xls");
			} catch (e) {
				print("Nested catch caught " + e);
			} finally {
				oWB.SaveAs(fname);
				oWB.Close(savechanges = false);
				oXL.Quit();
				oXL = null;
				idTmr = window.setInterval("Cleanup();", 1);
			}

		}
		else
		{
			tableToExcel(tableid)
		}
	}
	function Cleanup() {
		window.clearInterval(idTmr);
		CollectGarbage();
	}
	var tableToExcel = (function() {
		var uri = 'data:application/vnd.ms-excel;base64,',
				template = '<html><head><meta charset="UTF-8"></head><body><table>{table}</table></body></html>',
				base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) },
				format = function(s, c) {
					return s.replace(/{(\w+)}/g,
							function(m, p) { return c[p]; }) }
		return function(table, name) {
			if (!table.nodeType) table = document.getElementById(table)
			var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
			window.location.href = uri + base64(format(template, ctx))
		}
	})()

</script>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="javascript:;">车辆信息</a></li>
            <if condition="!($user_model == 4 && $admin['id'] != 10)">
			<li><a href="{:U('AdminCar/add',array('id'=>empty($item['id'])?'':$item['id']))}" target="_self">添加车辆</a></li>
            </if>
		</ul>
        <form class="well form-search" method="post" action="{:U('AdminCar/index')}">
            <!--<select name="s_tid">-->
                <!--<option value="">全部</option>-->
                <!--<foreach name="type_list" item="titem">-->

                    <!--<option <if condition="$s_tid == $titem['id']">selected</if> value="{$titem.id}">-->
                        <!--{$titem.title}-->
                    <!--</option>-->
                <!--</foreach>-->
            <!--</select> &nbsp;&nbsp;-->
            <!--关键字：-->
            <!--<input type="text" name="keyword" style="width: 200px;" value="{$keyword}" placeholder="请输入关键字...">-->
            <!--<input type="submit" class="btn btn-primary" value="搜索" />-->
            <!--<a class="btn btn-danger" href="{:U('AdminCar/index')}">清空</a>-->
        </form>
		<form class="js-ajax-form"  action="" method="post">

			<table class="table table-hover table-bordered table-list" id="tableExcel">
				<thead>
					<tr>
                        <th width="50">所属机构</th>
                        <th width="50">车牌号码</th>
						<th width="50">行驶本号码	</th>
						<th width="100">车主姓名</th>
                        <th width="50">保险日期</th>
                        <th width="50">上牌时间</th>
                        <th width="50">车辆所绑定手机</th>
                        <th width="50">绑定驾驶员	</th>
                        <th width="50">绑定会员卡	</th>
                        <th width="50">卡片余额	</th>
                        <th width="50">卡片积分	</th>
                        <th width="50">创建时间</th>
                        <if condition="!($user_model == 4 && $admin['id'] != 10)">
						<th width="70">{:L('ACTIONS')}</th>
                            </if>
					</tr>
				</thead>
				<foreach name="list" item="vo">
				<tr>
                    <td><b>{$vo.logistics_name}</b></td>
                    <td>{$vo.car_code}</td>
					<td>{$vo.car_licence}</td>
					<td>{$vo.car_master}</td>
					<td>{$vo.car_insurance}</td>
					<td>{$vo.car_regist_time}</td>
					<td>{$vo.car_mobile}</td>
					<td>{$vo.driver_name}</td>
					<td>{$vo.card_number}</td>
					<td>{$vo.balance}</td>
					<td>{$vo.point}</td>
					<td>{:date("Y-m-d H:i:s",$vo['create_time'])}</td>
                    <if condition="!($user_model == 4 && $admin['id'] != 10)">
					<td>

						<a href="{:U('AdminCar/unbind',array('id'=>$vo['id']))}" onclick="return confirm('确定解除会员卡及驾驶员的绑定?')">解绑</a> |
						<a href="{:U('AdminCar/add',array('id'=>$vo['id']))}">{:L('EDIT')}</a> |
						<a href="{:U('AdminCar/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:L('DELETE')}</a>

					</td>
                    </if>
				</tr>
				</foreach>

			</table>

			<div class="pagination">{$page}</div>
		</form>
		<!--<a class="btn btn-primary" style="float: right;margin-right:15px;margin-bottom:10px;" href="javascript:method5('tableExcel')">导出Excel</a>-->
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
		function refersh_window() {
			var refersh_time = getCookie('refersh_time');
			if (refersh_time == 1) {
				window.location = "{:U('AdminCar/index',$formget)}";
			}
		}

	</script>

</body>
</html>